{# Copyright The IETF Trust 2025, All Rights Reserved #}
{% load origin tz %}
{% origin %}
{% for s in sessions %}
    <tr>
        <td>
            {% if s.meeting.type.slug == 'ietf' %}
                IETF {{ s.meeting.number }}
            {% else %}
                {{ s.meeting.number }}
            {% endif %}
        </td>
        <td>
            {% if s.current_status == "sched" %}
                {% with timeslot=s.official_timeslotassignment.timeslot %}
                <span class="session-time date me-3" data-start-utc="{{ timeslot.time|utc|date:'Y-m-d H:i' }}" data-end-utc="{{ timeslot.end_time|utc|date:'Y-m-d H:i' }}"></span>
                {% endwith %}
            {% else %}
                <div class="badge rounded-pill text-bg-secondary">{{ s.current_status_name }}</div>
                {% if s.current_status == "canceled" %}
                    {% with timeslot=s.official_timeslotassignment.timeslot %}
                        <span class="text-decoration-line-through text-secondary session-time date me-3" data-start-utc="{{ timeslot.time|utc|date:'Y-m-d H:i' }}" data-end-utc="{{ timeslot.end_time|utc|date:'Y-m-d H:i' }}"></span>
                    {% endwith %}
                {% endif %}
            {% endif %}
            {% if show_request and s.meeting.type_id == 'ietf' %}
                {% if can_edit %}
                    <a class="btn btn-primary btn-sm"
                       href="{% url 'ietf.meeting.views_session_request.view_request' num=s.meeting.number acronym=s.group.acronym %}">
                        Edit Session Request
                    </a>
                {% endif %}
            {% endif %}
        </td>
        <td>
            {% if s.name %}{{ s.name }}{% endif %}
        </td>
        <td>
            {% if show_ical and s.current_status == "sched" %}
                {% if s.meeting.type_id == 'ietf' %}
                    <a class="btn btn-primary btn-sm"
                       aria-label="icalendar entry for {{s.group.acronym}} at IETF {{s.meeting.number}}"
                       title="icalendar entry for {{s.group.acronym}} at IETF {{s.meeting.number}}"
                       href="{% url 'ietf.meeting.views.agenda_ical' num=s.meeting.number session_id=s.id %}">
                        <i class="bi bi-calendar"></i>
                    </a>
                {% else %}
                    <a class="btn btn-primary btn-sm"
                       aria-label="icalendar entry for {{s.meeting.number}}"
                       title="icalendar entry for {{s.meeting.number}}"
                       href="{% url 'ietf.meeting.views.agenda_ical' num=s.meeting.number acronym=s.group.acronym %}">
                        <i class="bi bi-calendar"></i>
                    </a>
                {% endif %}
            {% endif %}
            <a class="btn btn-sm {% if not s.agenda %}btn-secondary disabled{% else %}btn-primary{% endif %}"
               {% if s.agenda %}href="{{ s.agenda.get_absolute_url }}"{% endif %}>
                Agenda
            </a>
            <a class="btn btn-sm {% if not s.minutes %}btn-secondary disabled{% else %}btn-primary{% endif %}"
               {% if s.minutes %}href="{{ s.minutes.get_absolute_url }}"{% endif %}>
                Minutes
            </a>
            {% if group.acronym == "iesg" %}
            <a class="btn btn-sm {% if not s.narrative_minutes %}btn-secondary disabled{% else %}btn-primary{% endif %}"
               {% if s.narrative_minutes %}href="{{ s.narrative_minutes.get_absolute_url }}"{% endif %}>
                Narrative Minutes
            </a>
            {% endif %}
            <a class="btn btn-primary btn-sm"
                href="{% url 'ietf.meeting.views.session_details' num=s.meeting.number acronym=s.group.acronym %}">
                {% if can_always_edit or can_edit_materials %}
                    <i class="bi bi-pencil-square">
                    </i>
                {% endif %}
                Materials
            </a>
            {% if not s.cancelled %}
                <div class="regular float-end">
                    {# see note in the included templates re: show_agenda parameter and required JS import #}
                    {% if s.meeting.type.slug == 'interim' %}
                        {% include "meeting/interim_session_buttons.html" with show_agenda=False show_empty=False session=s meeting=s.meeting %}
                    {% else %}
                        {% include "meeting/session_buttons_include.html" with show_agenda=False item=s.official_timeslotassignment session=s meeting=s.meeting %}
                    {% endif %}
                </div>
            {% endif %}
        </td>
    </tr>
{% endfor %}